8 research outputs found
A formalisation of the theory of context-free languages in higher order logic
We present a formalisation of the theory of context-free languages using the HOL4
theorem prover. The formalisation of this theory is not only interesting in its own right,
but also gives insight into the kind of manipulations required to port a pen-and-paper
proof to a theorem prover. The mechanisation proves to be an ideal case study of how
intuitive textbook proofs can blow up in size and complexity, and how details from the
textbook can change during formalisation.
The mechanised theory provides the groundwork for our subsequent results about
SLR parser generation. The theorems, even though well-established in the field, are
interesting for the way they have to be “reproven” in a theorem prover. Proofs must
be recast to be concrete enough for the prover: patching deductive gaps which are
relatively easily grasped in a text proof, but beyond the automatic capabilities of
contemporary tools. The library of proofs, techniques and notations developed here
provides a basis from which further work on verified language theory can proceed at a
quickened pace.
We have mechanised classical results involving context-free grammars and pushdown
automata. These include but are not limited to the equivalence between those two
formalisms, the normalisation of CFGs, and the pumping lemma for proving a language
is not context-free. As an application of this theory, we describe the verification of SLR
parsing. Among the various properties proven about the parser we show, in particular,
soundness: if the parser results in a parse tree on a given input, then the parse tree is
valid with respect to the grammar, and the leaves of the parse tree match the input;
and completeness: if the input belongs in the language of the grammar then the parser
constructs the correct parse tree for the input with respect to the grammar. In addition,
we develop a version of the algorithm that is executable by automatic translation
from HOL to SML. This alternative version of the algorithm requires some interesting
termination proofs.
We conclude with a discussion of the issues we faced while mechanising pen-and-paper
proofs. Carefully written formal proofs are regarded as rigorous for the audience they
target. But when such proofs are implemented in a theorem prover, the level of detail
required increases dramatically. We provide a discussion and a broad categorisation of
the causes that give rise to this
A formalisation of the normal forms of context-free grammars in HOL4
Abstract. We describe the formalisation of the normal forms of context-free grammars (CFGs) using the HOL4 theorem prover. These straightforward pen and paper proofs easily understood from the text turn out to be much harder to mechanise. The informal observations in the text become deductive gaps for a theorem prover that need to be patched
A Verified Packrat Parser Interpreter for Parsing Expression Grammars
Parsing expression grammars (PEGs) offer a natural opportunity for building
verified parser interpreters based on higher-order parsing combinators. PEGs
are expressive, unambiguous, and efficient to parse in a top-down recursive
descent style. We use the rich type system of the PVS specification language
and verification system to formalize the metatheory of PEGs and define a
reference implementation of a recursive parser interpreter for PEGs. In order
to ensure termination of parsing, we define a notion of a well-formed grammar.
Rather than relying on an inductive definition of parsing, we use abstract
syntax trees that represent the computational trace of the parser to provide an
effective proof certificate for correct parsing and ensure that parsing
properties including soundness and completeness are maintained. The correctness
properties are embedded in the types of the operations so that the proofs can
be easily constructed from local proof obligations. Building on the reference
parser interpreter, we define a packrat parser interpreter as well as an
extension that is capable of semantic interpretation. Both these parser
interpreters are proved equivalent to the reference one. All of the parsers are
executable. The proofs are formalized in mathematical terms so that similar
parser interpreters can be defined in any specification language with a type
system similar to PVS.Comment: 15 pages, 15 figures, Certified Proofs and Program
A mechanisation of some context-free language theory in HOL4
We describe the mechanisation of some foundational results in the theory of context-free languages (CFLs), using the HOL4 system. We focus on pushdown automata (PDAs). We show that two standard acceptance criteria for PDAs ("accept-by-empty-stack" and "accept-by-final-state") are equivalent in power. We are then able to show that the pushdown automata (PDAs) and context-free grammars (CFGs) accept the same languages by showing that each can emulate the other. With both of these models to hand, we can then show a number of basic, but important results. For example, we prove the basic closure properties of the context-free languages such as union and concatenation. Along the way, we also discuss the varying extent to which textbook proofs (we follow Hopcroft and Ullman) and our mechanisations diverge: sometimes elegant textbook proofs remain elegant in HOL; sometimes the required mechanisation effort blows up unconscionably
A Formalisation of the Normal Forms of Context-Free Grammars in HOL4
We describe the formalisation of the Chomsky and Greibach normal forms for context-free grammars (CFGs) using the HOL4 theorem prover. We discuss the varying degrees to which proofs that are straightforward on pen and paper, turn out to be much harder t
Verified, Executable Parsing
We describe the mechanisation of an SLR parser produced by a parser generator, covering background properties of context-free languages and grammars, as well as the construction of an SLR automaton. Among the various properties proved about the parser w
Mechanisation of PDA and Grammar Equivalence for Context-Free Languages
We provide a formalisation of the theory of pushdown automata (PDAs) using the HOL4 theorem prover. It illustrates how provers such as HOL can be used for mechanising complicated proofs, but also how intensive such a process can turn out to be. The proofs blow up in size in way difficult to predict from examining original textbook presentations. Even a meticulous text proof has "intuitive" leaps that need to be identified and formalised
Pinnacle: evaluation of the graduate teacher training program at the ANU
Pinnacle is the ANU’s teacher training programme for full time PhD students. The Pinnacle Teacher Training Program provides a mentoring system that aims to equip postgraduate students with the skills and theoretical background that they will need to become high quality lecturers. This article describes Pinnacle, and discusses the assessment of its effectiveness by past Pinnacle participants, using quantitative and qualitative feedback. There were differences in the perceived effectiveness of Pinnacle related to participants’ sex and their academic discipline. Overall, the participants found that the opportunity to deliver lectures, to work closely with their mentor, and to reflect on their own teaching philosophy and practice gave them a sense of being confident and competent teachers by the end of the programme. Pinnacle provides an opportunity to reflect on the practice of teaching before habit and academic pressures permanently shape teaching practices